/********************************************************************
created:	2014/08/05
created:	5:8:2014   16:06
filename: 	e:\WorkCode\QuoteBoard V6\include\SSQBAModel.h
file path:	e:\WorkCode\QuoteBoard V6\include
file base:	SSQBAModel
file ext:	h
author:		Alger

purpose:	QBA和服务端的接口
*********************************************************************/
#ifndef SS_QBAMODEL_H_
#define SS_QBAMODEL_H_

#include "SSQBModel.h"

#define _CSI_PRECISION 1E-5
#define _INVALID_CSI_VALUE -999999.0000

//#include "..\projects\ssbondnet\proto\variant.h"

typedef UINT	tDATE;					// 编码格式：20140512 表示2014年05月12日

//E_FID_QBA_ISSUE_RATE_REQ						= 53000,			//查询QBA 债券首页的发行与到期--利率债 童
typedef struct xQBAIssueRateReq_t {
	UINT		m_beginDate;
	UINT		m_endDate;
} QBAIssueRateReq_t, *PQBAIssueRateReq_t;

class xQBAIssueRateUnit_c
{
public:
	char		m_Bond_Key[32+1];
	char		m_Bond_ID[12];
	char		m_ListedMarket[8];									//市场代码
	char		m_shortName[32];									//简称
	char		m_shortName_En[64];									//简称-英文
	char		m_Bond_subtype[8];									//PPN  --则发行方式为私募，其余为公募
	UINT		m_Issue_Start_Date;									//发行日
	UINT		m_Payment_Date;										//缴款日
	double		m_Planned_Issue_Amount;								//计划发行量
	char		m_Maturity_Term[8];									//发行期限
	char		m_Term_Unit[3];										//
	char		m_Auction_Type[SELECTIVE_CODE_LEN];								//发行方式，AME=美国式；DUT=荷兰式；MIX=混合式；空则显示“-”
	//char		m_IssueType[32];									//不用
};

class xQBAIssueRateList_c {
public:
	std::list<xQBAIssueRateUnit_c> m_List;							//
} ;

//-----------------------------------------------------------------------------------
//E_FID_QBA_ISSUE_CREDIT_REQ					= 53001,			//查询QBA 债券首页的发行与到期--信用债 童
typedef struct xQBAIssueCreditReq_t {
	UINT		m_beginDate;
	UINT		m_endDate;
} QBAIssueCreditReq_t, *PQBAIssueCreditReq_t;

//class xInstitutionUnit_c
//{
//public:
//	char		m_Full_Name_C[64];
//};


class xQBAIssueCreditUnit_c
{
public:
	char		m_Bond_Key[32+1];
	char		m_Bond_ID[12];
	char		m_ListedMarket[8];									//市场代码
	char		m_shortName[32];									//简称
	char		m_shortName_En[32];									//简称-英文
	UINT		m_Issue_Start_Date;									//发行日
	double		m_Planned_Issue_Amount;								//计划发行量
	char		m_Maturity_Term[8];								//发行期限
	char		m_Term_Unit[3];										//单位
	char		m_Issuer_Rating_Current[12];						//评级
	std::list<xInstitutionUnit_c> m_VenderList;						//主承
	std::list<xInstitutionUnit_c> m_DistList;						//分销商
};

class xQBAIssueCreditList_c {
public:
	std::list<xQBAIssueCreditUnit_c> m_List;							//
} ;
//-----------------------------------------------------------------------------------
//E_FID_QBA_MATURITY_REQ						= 53002,			//查询QBA 债券首页的到期兑付 童
typedef struct xQBAMaturityReq_t {
	UINT		m_beginDate;
	UINT		m_endDate;
} QBAMaturityReq_t, *PQBAMaturityReq_t;

class xQBAMaturityUnit_c{											//付息兑付
public:
	UINT		m_beginDate;										//开始时间
	UINT		m_endDate;											//截止日期
	double		m_IssueAmount;										//发行总量
	UINT		m_IssueCnt;											//发行只数
	double		m_PayAmount;										//总偿还量
	double		m_NetFinance;										//净融资额 = 发行总量 - 总偿还量

};

class xQBAMaturityList_c {
public:
	std::list<xQBAMaturityUnit_c> m_List;						//
} ;

//E_FID_QBA_PUBLIC_OPTION_SETTING_QRY_V2 = 50407,			// 固收综合屏 公开市场操作-净投放计算公式查询
//请求
class xQBAPubOptSettingV2Req
{
public:
	//UserID
	char m_UserId[33];
	xQBAPubOptSettingV2Req()
	{
		memset(m_UserId, 0, sizeof(m_UserId));
	}
};
//应答
class xQBAPubOptSettingV2Ack
{
public:
	//UserID
	char m_UserId[33];
	//Select
	char m_Select[64];
	//InitFlag
	UINT m_nInitFlag;//0-not initialized,1-initialized
	xQBAPubOptSettingV2Ack()
	{
		memset(m_UserId, 0, sizeof(m_UserId));
		memset(m_Select, 0, sizeof(m_Select));
		m_nInitFlag = 0;
	}
};

//E_FID_QBA_PUBLIC_OPTION_SETTING_ADD_V2 = 50408,			// 固收综合屏 公开市场操作-净投放计算公式保存
//请求
typedef xQBAPubOptSettingV2Ack xQBAPubOperSettingAddV2Req;
//应答无包体，ErrorCode = 0 表示成功，否则失败

//-----------------------------------------------------------------------------------
//E_FID_QBA_YIELD_CURVE_REQ					= 53004,			//查询QBA 债券首页的收益率曲线 铨
//E_FID_QBA_YIELD_CURVE_REQ_V2				= 50342,			//综合分析 收益率曲线，V3.6后替换原53004消息
#define YIELD_CURVE_TYPE_NUM 19
typedef struct xQBAYieldCurveReq_t {								//默认取上一个交易日，昨天
	char		m_CurveType[32];									//GOV--国债,NDB--非国开,CBB--央行票据 CDB--国开,AAA,AAA-,AA+,AA,AA-,A+,A,A-
	UINT		m_Date{ 0 };	//QB5.0新增，兼容老版本，如果取不到或者为0默认为上一个交易日；如果能取到该字段，前端准确给到具体的交易日。
} QBAYieldCurveReq_t, *PQBAYieldCurveReq_t;

class xQBAYieldCurveUnit_c
{
public:
	char		m_Period[8];										//期限
	float		m_Yield;											//收益率
};

class xQBAYieldCurveList_c {
public:
	char		m_CurveType[32];									//曲线类型
	char		m_CurveName[64];									//曲线中文名称
	char		m_CurveName_En[256];								//曲线英文名称
	UINT		m_Date;												//日期
	std::list<xQBAYieldCurveUnit_c> m_List;							//
public:
	xQBAYieldCurveList_c(){
		memset(m_CurveType, 0, sizeof(char) * 32);
		memset(m_CurveName, 0, sizeof(char) * 64);
		memset(m_CurveName_En, 0, sizeof(char) * 256);
		m_Date = 0;
	}
	~xQBAYieldCurveList_c(){
	}
} ;

////-----------------------------------------------------------------------------------
////E_FID_QBA_BROKER_PRICE_REQ					= 53005,			//查询QBA 当天中介实时报价
typedef struct xQBABrokerPriceReq_t {
	char		m_Bond_Key[32+1];								
	char		m_ListedMarket[8];
	std::list<xQBTradeCmpyInfo_c>	m_List;						//经纪公司列表数据
} QBABrokerPriceReq_t, *PQBABrokerPriceReq_t;

class xQBABrokerPriceUnit_c
{
public:
	char		m_bond_key[32+1];									//Sumscope的BondKey	String
	char		m_listedmarket[8];									//市场代码
	char		m_goods_code[12];									//产品代码	String
	char		m_symbol[4];										//bid/ask标识',1--bid,-1,ofr
	char		m_price[8];											//收益率',
	char		m_volume[64];										//数量，总价',
	char		m_deal_status[8];									//订单状态 \n-1：待审核 \n0：发布\n1：成交\n2：作废',
	//char		m_description[128];									//
	//char		m_price_description[128];							//价格备注：如明天+1',
	char		m_flag_bargain[8];									//可议价*',
	char		m_flag_relation[8];									//OCO',
	char		m_flag_vip[8];										//vip标记',
	char		m_company_id[4];									//经纪公司ID',
	char		m_company_name[64];									//经纪公司名称',
	char		m_flag_bad[8];										//危险标记',
	time_t		m_modify_time;										//datetime DEFAULT NULL,
	time_t		m_create_time;										//datetime DEFAULT NULL,
	char		m_rebate[4];										//是否返点(0-不返，1返点)
	char		m_return_point[12];									//返点值(例: F0.10),值可以是0.0,也可以是空，代表不同的含义,空代表"全返",要注意区分
	char		m_net_price[8];										//	净价	String
	char		m_spread[8];										//	利差	String
	char		m_yield[8];											//	收益率	String
	char		m_full_price[8];									//	全价	String
	char		m_exercise[2];										//	行权到期  (0-行权 1-到期)	String
	char		m_delivery_date[10];								//	结算日期	String
	char		m_clear_speed[6];									//	清算速度 （T+0,T+1）	String

};
//
//class xQBABrokerPriceList_c {
//public:
//	std::list<xQBABrokerPriceUnit_c> m_BidList;					//
//	std::list<xQBABrokerPriceUnit_c> m_OfrList;					//
//	//std::list<xQBABrokerPriceUnit_c> m_List;						//原Bid Ofr 合并成一个List
//
//} ;

////-----------------------------------------------------------------------------------
////E_FID_QBA_BROKER_PRICE_PUSH					= 53006,			//QBA 接收中介报价推送
//typedef struct xQBABrokerPricePushReg_t {
//	char		m_Bond_Key[32+1];		
//	char		m_ListedMarket[8];
//} QBABrokerPricePushReg_t, *PQBABrokerPricePushReg_t;
//
//class xQBABrokerPricePushList_c {
//public:
//	std::list<xQBABrokerPriceUnit_c> m_List;						//行情列表，包含bid和ofr，可能会有其他的券，用的时候滤掉
//} ;

//-----------------------------------------------------------------------------------
//E_FID_QBA_BROKER_PRICE_PUSH_CANCEL			= 53007,			//取消接收中介报价推送
//请求同53006，无应答

//-----------------------------------------------------------------------------------
//E_FID_QBA_BROKER_PRICE_KLINE_DAY_OVERSEA_REQ		= 53038,	//集成定价 查询QBA 中介报价日线--海外版 童 
typedef struct xQBABrokerKlineDayReq_t {							//bengin,end 为-1 分别表示从最早 到 最新					
	char		m_bond_key[32+1];									//Sumscope的BondKey	String	
	char		m_listed_market[8];
	char		m_market_type[4];									//'b' = broker, 'c' = CFETS, 'e' = 交易所
	UINT		m_beginDate;
	UINT		m_endDate;
} QBABrokerKlineDayReq_t, *PQBABrokerKlineDayReq_t;

class xQBABrokerKlineDayUnit_c
{
public:
	char		m_bond_key[32+1];									//Sumscope的BondKey	String	
	char		m_listed_market[8];
	float		m_Yield;											//价格
	int			m_Symbol;											//(1:bid, -1: ask)
	UINT		m_Date;												//日期
};

class xQBABrokerKlineDayList_c {
public:
	char		m_markettype[4];									//'b' = broker, 'c' = CFETS, 'e' = 交易所
	std::list<xQBABrokerKlineDayUnit_c> m_List;						//
} ;


//-----------------------------------------------------------------------------------
//E_FID_QBA_CDC_PRICE_KLINE_DAY_REQ			= 53009,			//集成定价 查询QBA 估值报价日线 铨
//E_FID_QBA_CDC_PRICE_KLINE_DAY_REQ_V2		= 50343,			//集成定价 估值报价日线，V3.6后替换原53009消息
typedef struct xQBACDCKlineDayReq_t {							//bengin,end 为-1 分别表示从最早 到 最新					
	char		m_bond_key[32+1];									//Sumscope的BondKey	String	
	char		m_listedmarket[8];
	char		m_bond_id[12 + 1];
	UINT		m_beginDate;
	UINT		m_endDate;
	xQBACDCKlineDayReq_t()
	{
		memset(this, 0, sizeof(xQBACDCKlineDayReq_t));
	};
} QBACDCKlineDayReq_t, *PQBACDCKlineDayReq_t;

class xQBACDCKlineDayUnit_c
{
public:
	float		m_CleanPrice;										//净价
	float		m_Yield;											//收益率
	UINT		m_Date;												//日期
};

class xQBACDCKlineDayList_c {
public:
	char	m_bond_key[32+1];									//Sumscope的BondKey	String	
	char	m_listed_market[8];
	std::list<xQBACDCKlineDayUnit_c> m_List;						//
	xQBACDCKlineDayList_c()
	{
		memset(m_bond_key, 0, sizeof(m_bond_key));
		memset(m_listed_market, 0, sizeof(m_listed_market));
	};
} ;

//-----------------------------------------------------------------------------------
//E_FID_QBA_BROKER_DEAL_KLINE_DAY_REQ			= 53010,			//集成定价 查询QBA 成交日线 童 20131220
//请求同E_FID_QBA_BROKER_PRICE_KLINE_DAY_OVERSEA_REQ
class xQBABrokerDealKlineDayUnit_c
{
public:
	char		m_bond_key[32+1];									//Sumscope的BondKey	String	
	char		m_listedmarket[8];
	float		m_Yield;											//价格
	char		m_Deal_type[8];										//given/taken/trade, 这个字段暂时没用，因为目前要求是所有类型
	UINT		m_Date;												//日期
};

class xQBABrokerDealKlineDayList_c {
public:
	char		m_markettype[4];
	std::list<xQBABrokerDealKlineDayUnit_c> m_List;						//
} ;

//E_FID_QBA_CDC_PRICE_ALL_REQ					= 53014,			//主动交易 所有估值报价 铨 20131230
//E_FID_CS_PRICE_ALL_REQ						= 53015,			//所有中证估值报价 2.8 addy by lance 20160612
//无请求结构、应答如下，按字典格式保存，客户端解析的时候拿到VariantRaw解析到xQBACDCPriceList_c，再给缓存赋值
class xQBACDCPriceAll_c {
public:
	qb::proto::VariantRaw  m_CDCPrice;											//二进制中债估值数据,
} ;

//-----------------------------------------------------------------------------------
//E_FID_CSI_PRICE_ALL_REQ_V2					= 53409,	//中证估值V2请求号，行权/到期
//中证数据改版，将估计数据分成:行权和到期两部分
//由于之前中证数据大部分采用了中债估值的数据结构和协议，目前这两份数据在内容和结构上已经差别较，
//故中证数据独立出来。单独定义协议。

//Req
//NULL

//Ack
class  xCSIZipPack
{
public:
	//CSIPrice
	qb::proto::VariantRaw  m_CSIPrice;//二进制中债估值数据,
};

class xCSIUint_c
{
public:
	xCSIUint_c()
	{
		clear();
	}
public:
	char		m_bond_key[32 + 1];			//
	char		m_listedmarket[8];			//

	double		m_dCleanPriceMaturity;		//到期净价
	double		m_dFullPriceMaturity;		//到期全价
	double		m_dYieldToMaturity;			//到期收益率
	double		m_dModifiedDurationMarturity;//到期修正久期

	double		m_dCleanPriceExercise;		//行权净价
	double		m_dFullPriceExercise;		//行权全价
	double		m_dYieldToExercise;			//行权收益率
	double		m_dModifiedDurationExercise;//行权修正久期

	UINT		m_nDate;					//日期

	void		clear()
	{
		m_dCleanPriceMaturity = _INVALID_CSI_VALUE;
		m_dFullPriceMaturity = _INVALID_CSI_VALUE;
		m_dYieldToMaturity = _INVALID_CSI_VALUE;
		m_dModifiedDurationMarturity = _INVALID_CSI_VALUE;

		m_dCleanPriceExercise = _INVALID_CSI_VALUE;
		m_dFullPriceExercise = _INVALID_CSI_VALUE;
		m_dYieldToExercise = _INVALID_CSI_VALUE;
		m_dModifiedDurationExercise = _INVALID_CSI_VALUE;
		memset(this, 0, sizeof(xCSIUint_c));
	}

	inline bool IsHaveYieldToExercise(){return m_dYieldToExercise > _INVALID_CSI_VALUE;}
	inline bool IsHaveCleanPriceExercise(){return m_dCleanPriceExercise > _INVALID_CSI_VALUE;}
	inline bool IsHaveFullPriceExercise() { return m_dFullPriceExercise > _INVALID_CSI_VALUE; }
	inline bool IsModifiedDurationExercise(){return m_dModifiedDurationExercise > _INVALID_CSI_VALUE;}

	inline bool IsHaveYieldToMarturity(){return m_dYieldToMaturity > _INVALID_CSI_VALUE;}
	inline bool IsHaveCleanPriceMarturity(){return m_dCleanPriceMaturity > _INVALID_CSI_VALUE;}
	inline bool IsHaveFullPriceMarturity() { return m_dFullPriceMaturity > _INVALID_CSI_VALUE; }
	inline bool IsModifiedDurationMarturity(){return m_dModifiedDurationMarturity > _INVALID_CSI_VALUE;}

	inline bool IsHaveExercise()
	{
		return (IsHaveYieldToExercise() || IsHaveCleanPriceExercise() || IsModifiedDurationExercise() || IsHaveFullPriceExercise()) ? true : false;
	}

	inline bool IsHaveMarturity()
	{
		return (IsHaveYieldToMarturity() || IsHaveCleanPriceMarturity() || IsModifiedDurationMarturity() || IsHaveFullPriceMarturity()) ? true : false;
	}
};

class xCSIList_c
{
public:
	//List
	std::list<xCSIUint_c> m_List;
};

//-----------------------------------------------------------------------------------
//E_FID_CDC_AUTHORITY_CHANGE_PUSH					= 53030,			//中债估值 权限改变
//E_FID_CDC_AUTHORITY_CHANGE_PUSH_V2 = 50348,			//中债估值权限变化推送，V3.6后替换原53030消息
class xCDCAuthorityChange_c
{
public:
	char		m_UserID[32+1];									//用户UUID
	char		m_UserCompanyID[32+1];							//用户所在company的UUID，非经纪公司ID
	//char		m_info[32];										//"Grant"---授予中债权限，“Revoke” --取消中债估值权限
	//time_t	m_curtime;										//信号发生时间
};

//-----------------------------------------------------------------------------------
//E_FID_QBA_FINANCING_REQ						= 53031,			//融资养券--获取价格
typedef struct xQBAFinancingReq_t {		
	char				  m_fin_curvetype[32];						//设置曲线类型(估值曲线/中介成交曲线/报价曲线) "CDC"/"BC_DEAL"/"BC_OFR"
	char				  m_data_type[32];							//数据类型	，"BOND_GK"--国开债/"BOND_AACT"--AA城投债/"BOND_AAZDQ"--AA中短期票据/"BOND_DLDX"--低流动性债券	
	char				  m_remainTerm[16];							//剩余期限，"1Y"/"3Y"/"5Y"/"7Y"/"10Y"
	int					  m_beginDate;								//开始时间，-1表示最早，YYYYMMDD
	int					  m_endDate;								//结束时间，-1表示最新，YYYYMMDD
} QBAFinancingReq_t, *PQBAFinancingReq_t;

class xQBAFinancingUnit_c
{
public:
	float		m_Yield;											//收益率
	UINT		m_Date;												//日期
};

class xQBAFinancingList_c {
public:
	char				  m_fin_curvetype[32];						//设置曲线类型(估值曲线/中介成交曲线/报价曲线) "CDC"/"BC_DEAL"/"BC_OFR"
	char				  m_data_type[32];							//数据类型	，"BOND_GK"/"BOND_AACT"/"BOND_AAZDQ"/"BOND_DLDX"	
	char				  m_remainTerm[16];							//剩余期限，"1Y"/"3Y"/"5Y"/"7Y"/"10Y"
	std::list<xQBAFinancingUnit_c> m_List;							//
	xQBAFinancingList_c()
	{
		m_fin_curvetype[0] = '\0';
		m_data_type[0] = '\0';
		m_remainTerm[0] = '\0';
	}
} ;

//-----------------------------------------------------------------------------------
//E_FID_QBA_DEAL_ANALYSIS_AVG_REQ				= 53032,			//成交分析--获取成交平均价格

typedef struct xQBADealAyalysisAvgReq_t {	
	int						m_date;									//日期,YYYYMMDD
	std::list<xQBTradeCmpyInfo_c>	m_List;							//经纪公司列表数据
	std::list<xBondKey_c>	m_bondList;								//债券列表
} QBADealAyalysisAvgReq_t, *PQBADealAyalysisAvgReq_t;

class xQBADealAyalysisAvgUnit_c
{
public:
	char		m_Bond_Key[32+1];									//Sumscope的BondKey	String	
	char		m_Listed_Market[8];									//市场代码
	float		m_Yield;											//收益率
	int			m_date;												//日期,YYYYMMDD
};

class xQBADealAyalysisAvgList_c {
public:
	std::list<xQBADealAyalysisAvgUnit_c> m_List;					//
} ;

//E_FID_BOND_BASE_INFO_REQ = 53039,		//债券基础信息查询

struct	 QBBondBaseInfoReq
{
	int				m_date{ 0 };			//日期，0或-1默认为当日
	std::list<xBondKey_c>	m_bondList;	//债券列表
};

struct QBBondBaseInfoUnit
{
    char		m_Bond_Key[32 + 1];									//Sumscope的BondKey	String	
    //char		m_Listed_Market[8];									//市场代码
	char		m_sCSIDefaultRating[12];							//中证隐含违约率
	QBBondBaseInfoUnit() { memset(this, 0, sizeof(*this)); }
};

struct QBBondBaseInfoAck 
{
	std::list<QBBondBaseInfoUnit>	m_list; //应答列表
};



//E_FID_QBA_FINANCING_MACRO_INDEX_REQ			= 53034,			//融资养券--获取宏观指标数据
typedef struct xQBAFinancingMacroIndexReq_t {	
	int						m_begin;								//开始日期,YYYYMMDD，-1 最早
	int						m_end;									//结束日期,YYYYMMDD -1表示到最新
	char					m_IndexCode[32];						//指标代码
	/*
	代码		中文说明
	GC001	利率:收盘:上交所:质押式回购:1天
	GC002	利率:收盘:上交所:质押式回购:2天
	GC003	利率:收盘:上交所:质押式回购:3天
	GC004	利率:收盘:上交所:质押式回购:4天
	GC007	利率:收盘:上交所:质押式回购:7天
	GC014	利率:收盘:上交所:质押式回购:14天
	GC028	利率:收盘:上交所:质押式回购:28天
	GC091	利率:收盘:上交所:质押式回购:91天
	GC182	利率:收盘:上交所:质押式回购:182天
	R001	利率:加权平均:银行间债券:质押式回购:1天
	R007	利率:加权平均:银行间债券:质押式回购:7天
	R014	利率:加权平均:银行间债券:质押式回购:14天
	R021	利率:加权平均:银行间债券:质押式回购:21天
	R1M		利率:加权平均:银行间债券:质押式回购:1个月
	R2M		利率:加权平均:银行间债券:质押式回购:2个月
	R3M		利率:加权平均:银行间债券:质押式回购:3个月
	R4M		利率:加权平均:银行间债券:质押式回购:4个月
	R6M		利率:加权平均:银行间债券:质押式回购:6个月
	R9M		利率:加权平均:银行间债券:质押式回购:9个月
	R1Y		利率:加权平均:银行间债券:质押式回购:1年
	*/

} QBAFinancingMacroIndexReq_t, *PQBAFinancingMacroIndexReq_t;

class xQBAFinancingMacroIndexUnit_c
{
public:
	int						m_date;									//指标日期 
	double					m_value;								//指标值
};

class xQBAFinancingMacroIndexList_c {
public:
	char										m_IndexCode[32];		//指标代码
	std::list<xQBAFinancingMacroIndexUnit_c>	m_List;					//指标列表
	xQBAFinancingMacroIndexList_c()
	{
		m_IndexCode[0] = '\0';
	}
} ;


//--E_FID_QB_DATE_YIELD_CURVE_REQ   58023   //获取债券所在期限的过去天数的CDC值
//E_FID_QB_DATE_YIELD_CURVE_REQ_V2			= 50347,			//平安，国债所在期限的点过去天数的数据，V3.6后替换原58023消息
//request
//E_FID_QB_DATE_YIELD_CURVE_REQ
//58023,获取债券所在期限的过去天数的CDC值
//xQBDateYieldCurveReq
typedef struct xQBDateYieldCurveReq_t 
{
	//UserID
	char		m_UserID[32+1];			//用户id
	//CompanyID
	char		m_CompanyID[32+1];		//用户所在机构I
	//CurveType
	char				  m_CurveType[32];									//CDC.CIB.FRB.GOV
	//MaturityTerm
	char				  m_rMaturityTerm[16];							//期限，"1Y"/"3Y"/"5Y"/"7Y"/"10Y"
	//beginDate
	int					  m_beginDate;								//开始时间，-1表示最早，YYYYMMDD
	//endDate
	int					  m_endDate;								//结束时间，-1表示最新，YYYYMMDD
} QBDateYieldCurveReq_t, *PQBDateYieldCurveReq_t;

//inner
//
//
//xQBDateYieldCurveUnit
class xQBDateYieldCurveUnit_c
{
public:
	//Yield
	float		m_Yield;											//收益率
	//Date
	int		m_Date;												//日期
};

//response
//E_FID_QB_DATE_YIELD_CURVE_REQ
//58023,获取债券所在期限的过去天数的CDC值
//xQBDateYieldCurveList
class xQBDateYieldCurveList_c
{
public:
	//UserID
	char		m_UserID[32+1];			//用户id
	//CompanyID
	char		m_CompanyID[32+1];		//用户所在机构I
	//CurveType
	char				  m_CurveType[32];							//曲线类型
	//MaturityTerm
	char				  m_rMaturityTerm[16];					//期限，"1Y"/"3Y"/"5Y"/"7Y"/"10Y"
	//List
	std::list<xQBDateYieldCurveUnit_c> m_List;						//
	//FunctionBegin
	//初始值
	xQBDateYieldCurveList_c()
	{
		m_UserID[0] = '\0';
		m_CompanyID[0] = '\0';
		m_CurveType[0] = '\0';
		m_rMaturityTerm[0] = '\0';
	}
	//FunctionEnd
};

//请求
typedef struct xQBABrokerKlineDayCloseReq_t { //bengin,end 为-1 分别表示从最早 到 最新 
	char m_bond_key[32 + 1]; //Sumscope的BondKey String 
	char m_listed_market[8];
	char m_market_type[4]; //'b' = broker, 'c' = CFETS, 'e' = 交易所
	int m_beginDate;
	int m_endDate;
} QBABrokerKlineDayCloseReq_t, * PQBABrokerKlineDayCloseReq_t;

class xQBABrokerKlineDayCloseUnit_c
{
public:
	char m_bond_key[32 + 1]; //Sumscope的BondKey String 
	char m_listed_market[8];
	float m_Yield; //成交收盘收益率
	float m_AverageClean;//成交日均净价
	float m_CloseClean; //成交收盘净价
	int m_Symbol; //(1:bid, -1: ask)
	UINT m_Date; //日期
};

class xQBABrokerKlineDayCloseList_Ack {
public:
	char m_markettype[4]; //'b' = broker, 'c' = CFETS, 'e' = 交易所
	std::list<xQBABrokerKlineDayCloseUnit_c> m_List; //
};

//请求-请求报价bid收盘和ofr收盘
typedef struct xQBABrokerKlineDayCloseBoReq_t { //bengin,end 为-1 分别表示从最早 到 最新 
	char m_bond_key[32 + 1]; //Sumscope的BondKey String 
	UINT m_beginDate;
	UINT m_endDate;
} QBABrokerKlineDayCloseBoReq_t, * PQBABrokerKlineDayCloseBoReq_t;


//响应
class xQBABrokerKlineDayCloseBoUnit_c
{
public:
	char m_bond_key[32 + 1]; //Sumscope的BondKey String 
	float m_BidCloseYield; //bid收盘收益率
	float m_OfrCloseYield; //ofr收盘收益率
	float m_BidCloseClean; //bid收盘净价
	float m_OfrCloseYClean; //ofr收盘净价
	int m_Symbol; //(1:bid, -1: ask)
	UINT m_Date; //日期
};


class xQBABrokerKlineDayCloseBoList_c {
public:
	std::list<xQBABrokerKlineDayCloseBoUnit_c> m_List; //
};

//E_FID_QBA_CNEX_INDEX_REQ = 50415,        //请求CNEX资金面情绪指数数据
class xQBACNEXUnit_c
{
    using FLOAT=float;
public:
	char m_CNEXTimeNode[6];	// exp：8:45；10:15；14:30；16:00

	FLOAT m_CNEXAllMarket;	//全市场

	FLOAT m_CNEXAllBank;	//大型银行

	FLOAT m_CNEXSmallBank;	//中小银行

	FLOAT m_CNEXNotBank;	//非银机构

	time_t m_CNEXTime;//时间戳

	int m_index;//序列号

	xQBACNEXUnit_c()
	{
        //ZeroMemory(m_CNEXTimeNode, sizeof(m_CNEXTimeNode));
		m_CNEXAllMarket = 1e-18f;
		m_CNEXAllBank = 1e-18f;
		m_CNEXSmallBank = 1e-18f;
		m_CNEXNotBank = 1e-18f;
		m_CNEXTime = 0;
		m_index = 0;
	}

	xQBACNEXUnit_c& operator=(const xQBACNEXUnit_c& that)
	{
		strcpy(m_CNEXTimeNode, that.m_CNEXTimeNode);
		m_CNEXAllMarket = that.m_CNEXAllMarket;
		m_CNEXAllBank = that.m_CNEXAllBank;
		m_CNEXSmallBank = that.m_CNEXSmallBank;
		m_CNEXNotBank = that.m_CNEXNotBank;
		m_CNEXTime = that.m_CNEXTime;
		m_index = that.m_index;
		return *this;
	}
};

class xQBACNEXMap
{
public:
	std::map<int, xQBACNEXUnit_c> m_CNEXMap;
};

class xQBACNEXList_c
{
public:
	int m_countPerDay;

	std::list<xQBACNEXUnit_c> m_CNEXList;

	xQBACNEXList_c()
	{
		m_countPerDay = 0;
		m_CNEXList.clear();
	}
};
#endif
